package com.tcd.customer.contrller;

import com.tcd.pojo.Client.RecognizeeInfo;
import com.tcd.customer.service.RecognizeeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/recognizeeInfoController")
public class RecognizeeInfoController {
    @Autowired
    RecognizeeInfoService recognizeeInfoService;

    @RequestMapping("/getAll")
    public List<RecognizeeInfo> getAll(){
        List<RecognizeeInfo> list=recognizeeInfoService.getAll();
        System.out.println(list);
        return list;
    }

    @RequestMapping("/query")
    public List<RecognizeeInfo> query(String recognizeeName,String credentialsId){
        List<RecognizeeInfo> list=recognizeeInfoService.query(recognizeeName,credentialsId);
        System.out.println(list);
        return list;
    }

    @RequestMapping("/addPolicyholdersInfo")
    public int addPolicyholdersInfo(RecognizeeInfo recognizeeInfo){
        System.out.println(recognizeeInfo);
        int row=recognizeeInfoService.addPolicyholdersInfo(recognizeeInfo);
        return row;
    }

    @RequestMapping("/amendRow")
    public int amendRow(RecognizeeInfo recognizeeInfo){
        System.out.println(recognizeeInfo);
        int row=recognizeeInfoService.amendRow(recognizeeInfo);
        return row;
    }

    @RequestMapping("/deleteRow")
    public int deleteRow(int recognizeeId){
        System.out.println(recognizeeId);
        return recognizeeInfoService.deleteRow(recognizeeId);
    }

}
